<!DOCTYPE html>
<html>
	<head>
	    <meta charset="utf-8">
	    <meta name="viewport" content="width=device-width, initial-scale=1.0">
	    <title> - 公告管理</title>
	    <meta name="keywords" content="">
	    <meta name="description" content="">
	    <link rel="shortcut icon" href="favicon.ico"> <link href="__STATIC__/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
	    <link href="__STATIC__/css/font-awesome.css?v=4.4.0" rel="stylesheet">
	    <link href="__STATIC__/css/plugins/jqgrid/ui.jqgrid.css?0820" rel="stylesheet">
	    <link href="__STATIC__/css/animate.css" rel="stylesheet">
	    <link href="__STATIC__/css/style.css?v=4.1.0" rel="stylesheet">
	    <link href="__STATIC__/css/new_file.css" rel="stylesheet">
	</head>
	<body class="gray-bg">
	    <div class="wrapper wrapper-content  animated fadeInRight">
	        <div class="row">
	            <div class="col-sm-12">
	                <div class="ibox">
	                	<div class="ibox-title">
	                        <h5>公告管理</h5>
	                    </div>
	                    <div class="ibox-content">
	                    	<a href="Notice.html"><button type="button" class="btn btn-w-m btn-info btn-bt">公告管理</button></a>
	                    	<a href="Notice_1.html"><button type="button" class="btn btn-w-m btn-white btn-bt">历史记录</button></a>
	                        <div class="clients-list">
	                            <ul class="nav nav-tabs">
	                                <li class="active"><a data-toggle="tab" href="#tab-1">标题公告</a>
	                                </li>
	                                <li class=""><a data-toggle="tab" href="#tab-2">跑马灯</a>
	                                </li>
	                            </ul>
	                            <div class="tab-content">
	                                <div id="tab-1" class="tab-pane active">
										<form class="form-horizontal from-ban"><br/>
				                            <div class="form-group">
				                                <label class="col-sm-2 control-label">标题：</label>
				
				                                <div class="col-sm-8">
				                                    <input type="text" placeholder="10个汉字以内" class="form-control" id="notice_title">
				                                    <span class="help-block m-b-none">请输入标题</span>
				                                </div>
				                            </div>
				                            <div class="form-group">
				                                <label class="col-sm-2 control-label">排序：</label>
				                                <div class="col-sm-8">
				                                    <input type="text" placeholder="数字越大，显示越靠前" class="form-control" id="notice_sort">
				                                    <span class="help-block m-b-none">请输入排序</span>
				                                </div>
				                            </div>
				                            <div class="form-group">
				                                <label class="col-sm-2 control-label">上线时间：</label>
				                                <div class="col-sm-8">
				                                    <input type="text" placeholder="请输入上线时间" class="form-control form-time-bk" id="notice_time" readonly="readonly">
				                                    <span class="help-block m-b-none">请输入上线时间</span>
				                                </div>
				                            </div>
				                            <div class="form-group">
				                                <label class="col-sm-2 control-label">公告内容：</label>
				                                <div class="col-sm-8">
				                                    <textarea placeholder="内容500汉字以内" class="form-control form-textarea" id="notice_content"></textarea>
				                                    <span class="help-block m-b-none">请输入公告内容</span>
				                                </div>
				                            </div>
				                            <div class="col-sm-4 col-sm-offset-2">
			                                    <button class="btn btn-info" type="button" onclick="notice()">创建</button>
			                                </div>
				                        </form>
	                                </div>
	                                <div id="tab-2" class="tab-pane">
	                                    <form class="form-horizontal from-ban"><br/>
				                            <div class="form-group">
				                                <label class="col-sm-2 control-label">生效时间：</label>
				                                <div class="col-sm-8">
				                                    <input type="text" placeholder="请输入上线时间" class="form-control form-time-bk" id="horse_time" readonly="readonly">
				                                    <span class="help-block m-b-none">请输入上线时间</span>
				                                </div>
				                            </div>
				                            <div class="form-group">
				                                <label class="col-sm-2 control-label">播放时间间隔（秒）：</label>
				                                <div class="col-sm-8">
				                                    <input type="text" placeholder="请输入播放时间间隔（秒）" class="form-control" id="horse_interval_time">
				                                    <span class="help-block m-b-none">请输入播放时间间隔（秒）</span>
				                                </div>
				                            </div>
				                            <div class="form-group">
				                                <label class="col-sm-2 control-label">活动内容：</label>
				                                <div class="col-sm-8">
				                                    <textarea placeholder="内容500汉字以内" class="form-control form-textarea" id="horse_content"></textarea>
				                                    <span class="help-block m-b-none">请输入活动内容</span>
				                                </div>
				                            </div>
				                            <div class="col-sm-4 col-sm-offset-2">
			                                    <button class="btn btn-info" type="button" onclick="horse()">创建</button>
			                                </div>
				                        </form>
	                                </div>
	                            </div>
	                        </div>
	                    </div>
	                </div>
	            </div>
	        </div>
	    </div>
<!--手机导航-->
<div class="to-fdh" style="display: none;">
	<img class="to-imgd" src="__STATIC__/img/phonedh.jpg">
	<div class="mob-nrlb">
		<ul>
			<li>
				<a class="mob-nrdh">管理</a>
				<ul class="mob-nryc">
					<li class="mob-nrdhli">
						<a href="{:url('Player/gameplayer')}">玩家管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('system/notice')}">公告管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('email/mail')}">邮件管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('Club/club')}">亲友圈管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('Money/money')}">提现管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('Order/order')}">订单管理</a>
					</li>
				</ul>
			</li>
			<li>
				<a class="mob-nrdh">数据</a>
				<ul class="mob-nryc">
					<li class="mob-nrdhli">
						<a href="{:url('data/datagk')}">概況</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/datawf')}">玩法</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/datalc')}">留存</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/datass')}">实时数据</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/dataczfx')}">充值分析</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/dataclub')}">亲友圈统计</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/president')}">高级会长</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/regionaldata')}">地区数据</a>
					</li>
				</ul>
			</li>
			<li>
				<a class="mob-nrdh mob-qbh">权限</a>
				<ul class="mob-nryc">
					<li class="mob-nrdhli">
						<a href="{:url('rule/rule_list')}">权限管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('rule/rule_group')}">用户组管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('account/account_details')}">后台账号管理</a>
					</li>
				</ul>
			</li>
		</ul>
	</div>
</div>
<div id="zkbg">
	<img src="__STATIC__/img/dp.gif">
</div>
<div class="vnl-zz" style="display:none">
	<div><img src="__STATIC__/img/bqhp.gif"></div>
</div>
<!--手机适配-->
		<script src="__STATIC__/js/jquery.min.js?v=2.1.4"></script>
		<script src="__STATIC__/js/bootstrap.min.js?v=3.3.6"></script>
		<script src="__STATIC__/js/plugins/peity/jquery.peity.min.js"></script>
		<script src="__STATIC__/js/plugins/jqgrid/i18n/grid.locale-cn.js?0820"></script>
		<script src="__STATIC__/js/plugins/jqgrid/jquery.jqGrid.min.js?0820"></script>
		<script src="__STATIC__/js/content.js?v=1.0.0"></script>
		<script src="__STATIC__/js/plugins/laydate/laydate.js"></script>
		<script>
            //手机适配
            $(function(){
                if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) {
                    $("head").append("<link>");
                    var css = $("head").children(":last");
                    css.attr({
                        rel:  "stylesheet",
                        type: "text/css",
                        href: "__STATIC__/css/phone_sp.css"
                    });
                    var mql = window.matchMedia("(orientation: portrait)");
                    if(mql.matches) { //竖屏样式
                        $(".vnl-zz").show();
                        $(".to-fdh").hide();
                    }else{
                        $(".to-fdh").show();
                        $("html").width("100%");
                        $("body").width("100%");
                    }
                    mql.addListener(function(m) {
                        if(m.matches) {
                            // 改变到直立方向
                            $(".vnl-zz").show();
                            $(".to-fdh").hide();
                        }
                        else {
                            $(".to-fdh").show();
                            $(".vnl-zz").hide();
                            $("html").width("100%");
                            $("body").width("100%");
                        }
                    });
                }
            });
            //导航显示展开
            $(".mob-nrdh").click(function(){
                $(this).next().toggle(".mob-nryc");
            });
            $(".to-imgd").click(function(){
                $(this).next().toggle(".mob-nrlb");
            });
            //手机适配end
        $(document).ready(function () {
		    laydate.render({
		      elem: '#notice_time'
		      ,type: 'datetime'
		      ,range: true
		    });
		    laydate.render({
		      elem: '#horse_time'
		      ,type: 'datetime'
		      ,range: true
		    });
        });
        function notice(){
	        	var Data={
		          title:$("#notice_title").val(),
		          content:$("#notice_content").val(),
		          sort:$("#notice_sort").val(),
		          time:$("#notice_time").val()
		        };
		        if(Data.title ==""){
        			alert("标题不能为空");
        			return false;
        		}
				if(Data.title.length >10){
					alert("标题不得超过10个字");
					return false;
				}
        		if(Data.content ==""){
        			alert("内容不能为空");
        			return false;
        		}
				if(Data.content .length >500){
					alert("内容需500字以内");
					return false;
				}
        		if(Data.sort ==""){
        			alert("排序不能为空");
        			return false;
        		}
        		if(Data.time ==""){
        			alert("时间不能为空");
        			return false;
        		}
		        var start_time = Data.time.substring(0,19);
		        var end_time = Data.time.substring(22);
		        // console.log(end_time);
			    $.ajax({
					type: "post",
					url: "__URL__/notice_add",
					data: {
						'title':Data.title,
						'content':Data.content,
						'sort':Data.sort,
						'start_time':start_time,
						'end_time':end_time,
					},
					dataType: "json",
					success: function(e) {
						console.log(e);
						var json = eval("("+e+")");
						alert(json.msg);
						location.reload();
					},
					error: function(e) {
						// console.log(e);
						var json = eval("("+e+")");
						alert(json.msg);
					}
				});
	        };
	           function horse(){

	        	var Data={
		          content:$("#horse_content").val(),
		          interval_time:$("#horse_interval_time").val(),
		          time:$("#horse_time").val()
		        };
        		if(Data.content ==""){
        			alert("内容不能为空");
        			return false;
        		}
        		if(Data.content .length >500){
                       alert("内容需500字以内");
                       return false;
                 }

        		if(Data.interval_time ==""){
        			alert("时间间隔不能为空");
        			return false;
        		}
        		if(Data.time ==""){
        			alert("时间不能为空");
        			return false;
        		}
		        // console.log(Data.interval_time);
		        var start_time = Data.time.substring(0,19);
		        var end_time = Data.time.substring(22);
			    $.ajax({
					type: "post",
					url: "__URL__/horse_add",
					data: {
						'content':Data.content,
						'speed':Data.interval_time,
						'start_time':start_time,
						'end_time':end_time,
					},
					dataType: "json",
					success: function(e) {
						// alert(e.code);
						// alert(e.msg);
						// console.log(e);
						var json = eval("("+e+")");
						alert(json.msg);
						location.reload();
					},
					error: function(e) {
						// alert(e.msg);
						var json = eval("("+e+")");
						alert(json.msg);
					}
				});
	        };
	    </script>
	</body>
</html>
